﻿using ModelDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkflowCore.Interface;

namespace WorkFlow
{
    public class MyWorkflow : IWorkflow<MyDataClass>
    {
        public string Id => "Zqh";

        public int Version => 1;

        public void Build(IWorkflowBuilder<MyDataClass> builder)
        {
            builder
                .StartWith<FirstStepBody>()
                .Input(step => step.Input1, data => data.Value1)
                .Input(step => step.Input2, data => data.Value2)
                .Output(data => data.Answer, step => step.Output)
                .WaitFor("MyEvent", key => "EventKey")
                .Output(data => data.secondDataClass.First, wait => wait.EventData.ToString())
                //执行下一个工作流
                .Then<SecondStepBody>()
                .Input(step => step.One, data => data.secondDataClass.First)
                .Input(step => step.Two, data => data.secondDataClass.Second)
                .Output(data => data.secondDataClass.SumStr, step => step.StrSum);
        }
    }
}
